package com.llap.exp190929.repository;

import com.llap.exp190929.entity.Book;
import com.llap.exp190929.entity.BookType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface BookRepository extends JpaRepository<Book, Integer> {
    Page<Book> findAllByType(BookType type, Pageable pageable);
    Page<Book> findAll(Specification<Book> spec, Pageable pageable);
    Book findByCode(String code);
    void deleteByIdAndBorrowedUserIsNotNull(Integer id);
}
